import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Scanner;


public class Test02 {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		System.out.println("Input name:");
		String name = scanner.nextLine();
		try{
			Connection conn = JDBCUtil.getConnection();
			Statement st = conn.createStatement();
			String sql = "select * from Sample where Name='"+name+"'";
			System.out.println(sql);
			ResultSet rs = st.executeQuery(sql);
			while(rs.next()){
				System.out.println(rs.getString("Name")+"\t"+rs.getInt("Age"));
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
